feat: add stellar support to backend relayer and update unit and e2e …#112
feat: add stellar support to backend relayer and update unit and e2e …#112
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (6)
📒 Files selected for processing (61)
📝 WalkthroughWalkthroughAdds comprehensive Stellar blockchain support including SEP-10 authentication, Soroban contract interactions, and multi-chain address handling. Refactors EVM-only abstractions into a multi-chain ChainAdapter pattern, redesigns authentication to be chain-aware with separate EVM and Stellar services, introduces Stellar-specific cryptographic utilities and address conversions, and extends test infrastructure with Stellar deployment and integration test support. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant AuthController
participant AuthService
participant EvmAuthService
participant StellarAuthService
participant Prisma
Client->>AuthController: POST /v1/auth/challenge<br/>{address, chainKind}
AuthController->>AuthService: challenge(address, chainKind)
alt chainKind === EVM
AuthService->>EvmAuthService: buildChallenge(address)
EvmAuthService->>EvmAuthService: validate EVM address
EvmAuthService->>EvmAuthService: generate nonce
EvmAuthService->>Prisma: authNonce.create()
EvmAuthService-->>AuthService: {chainKind, nonce, address, expiresAt, domain, uri}
else chainKind === STELLAR
AuthService->>StellarAuthService: buildChallenge(address)
StellarAuthService->>StellarAuthService: validate G... public key
StellarAuthService->>StellarAuthService: build SEP-10 transaction
StellarAuthService-->>AuthService: {chainKind, address, transaction, networkPassphrase, expiresAt}
end
AuthService-->>AuthController: challenge response
AuthController-->>Client: 200 OK + response
Client->>AuthController: POST /v1/auth/login<br/>{chainKind, message?, signature?, transaction?}
AuthController->>AuthService: login({chainKind, ...})
alt chainKind === EVM
AuthService->>EvmAuthService: verifyLogin(message, signature)
EvmAuthService->>EvmAuthService: parse & verify SIWE
EvmAuthService->>EvmAuthService: verify signature
EvmAuthService->>Prisma: consume nonce, upsert user
EvmAuthService-->>AuthService: {id, username, walletAddress}
else chainKind === STELLAR
AuthService->>StellarAuthService: verifyLogin(transaction)
StellarAuthService->>StellarAuthService: verify SEP-10 transaction
StellarAuthService->>Prisma: record nonce, upsert user
StellarAuthService-->>AuthService: {id, username, walletAddress}
end
AuthService->>AuthService: mintTokenPair(user)
AuthService-->>AuthController: {tokens: {access, refresh}}
AuthController-->>Client: 201 Created + tokens
sequenceDiagram
participant AdsService
participant ChainAdapterService
participant ChainAdapter
participant EvmChainAdapter as EVM Adapter
participant StellarChainAdapter as Stellar Adapter
participant ViemService
participant StellarService
AdsService->>ChainAdapterService: forChain(ChainKind.EVM)
ChainAdapterService-->>AdsService: EvmChainAdapter
AdsService->>AdsService: determine chain from request
AdsService->>EvmChainAdapter: getCreateAdRequestContractDetails(data)
EvmChainAdapter->>EvmChainAdapter: validate EVM addresses
EvmChainAdapter->>ViemService: getCreateAdRequestContractDetails(data)
ViemService-->>EvmChainAdapter: {chainId, contractAddress, signature, authToken, ...}
EvmChainAdapter-->>AdsService: contract details + signature
AdsService->>ChainAdapterService: forChain(ChainKind.STELLAR)
ChainAdapterService-->>AdsService: StellarChainAdapter
AdsService->>StellarChainAdapter: getCreateAdRequestContractDetails(data)
StellarChainAdapter->>StellarChainAdapter: validate Stellar addresses (0x32-byte hex)
StellarChainAdapter->>StellarService: getCreateAdRequestContractDetails(data)
StellarService->>StellarService: compute request hash (Keccak256)
StellarService->>StellarService: sign with Stellar Ed25519 key
StellarService-->>StellarChainAdapter: {chainId, contractAddress, signature, authToken, ...}
StellarChainAdapter-->>AdsService: contract details + signature
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…tests
Summary by CodeRabbit
New Features
API Changes
/v1/ads/createand/v1/trades/createchainKindparameter to authentication requests for chain-specific flows